package com.sniper.springmvc.mybatis.service.impl;

import com.sniper.springmvc.datasource.DataSource;
import com.sniper.springmvc.datasource.DataSourceValue;
import com.sniper.springmvc.model.AdminUser;
import com.sniper.springmvc.mybatis.service.BaseService;

import java.util.List;

public interface AdminUserService extends BaseService<AdminUser> {

    @DataSource(DataSourceValue.SLAVE)
    public AdminUser validateByName(String username);

    @DataSource(DataSourceValue.SLAVE)
    public AdminUser getUserAndGroupAndRight(String username);

    @DataSource(DataSourceValue.SLAVE)
    public AdminUser validateByNickName(String username);

    @DataSource(DataSourceValue.SLAVE)
    public AdminUser validateByEmail(String email);

    @DataSource(DataSourceValue.SLAVE)
    public List<AdminUser> findListByEmail(String email);

    @DataSource(DataSourceValue.SLAVE)
    public boolean validateUser(String name, String password);

    @DataSource
    public void changePassword(String password_old, String password_c);


    /**
     * 前台注册用户
     *
     * @param user
     * @param password
     * @return
     */
    AdminUser regUser(AdminUser user, String password);


    @DataSource
    public int changePasswd(String username, String passwd);

}
